package com.pwt.controller.crustallus;

import com.pwt.common.CustomException;
import com.pwt.model.ChartModel;
import com.pwt.model.CrustalLusModel;
import com.pwt.model.TreeModel;
import com.pwt.model.crustallus.*;
import com.pwt.model.what.CharacteristicsModel;
import com.pwt.model.what.OverviewModel;
import com.pwt.service.CrustalLusService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author dw
 * @version 1.0.0
 * @date 2021/9/26
 */
@RestController
@RequestMapping("/lus")
@Tag(name = "能力模块")
public class CrustalLusController {

    private CrustalLusService crustalLusService;

    public CrustalLusController(CrustalLusService crustalLusService) {
        this.crustalLusService = crustalLusService;
    }

    @GetMapping("/header")
    @Parameters({
            @Parameter(name = "k0053",description = "订单id",required = false),
            @Parameter(name = "k1000",description = "零件id",required = true),
            @Parameter(name = "k0010",description = "机器id",required = true),
            @Parameter(name = "startTime",description = "开始时间 yyyy-MM-dd HH:mm:ss",required = true),
            @Parameter(name = "endTime",description = "结束时间 yyyy-MM-dd HH:mm:ss",required = true)
    })
    @Operation(description = "单值图头部查询",summary = "单值图头部查询")
    public LusHeaderModel getLusHeader(@RequestParam(required = false) String k0053 , Integer k1000, Integer k0010,String startTime, String endTime){
        return this.crustalLusService.getLusHeader(k0053,k1000,k0010, startTime,endTime);
    }


    @GetMapping("/table")
    @Parameters({
            @Parameter(name = "k0053",description = "订单id",required = false),
            @Parameter(name = "k1000",description = "零件id",required = true),
            @Parameter(name = "k0010",description = "机器id",required = true),
            @Parameter(name = "startTime",description = "开始时间 yyyy-MM-dd HH:mm:ss",required = true),
            @Parameter(name = "endTime",description = "结束时间 yyyy-MM-dd HH:mm:ss",required = true),
            @Parameter(name = "page",description = "当前页",required = true),
            @Parameter(name = "limit",description = "展示数",required = true)
    })
    @Operation(description = "被测参数表格查询",summary = "被测参数表格查询")
    public LusModel<OverviewModel> getOverViewValueChart(@RequestParam(required = false) String k0053 , Integer k1000, Integer k0010,String startTime, String endTime, Integer page, Integer limit){
       return this.crustalLusService.getOverViewValueChart(k0053,k1000,k0010,startTime,endTime,page,limit);
    }

    @GetMapping("/chart")
    @Parameters({
            @Parameter(name = "k1000",description = "零件编号",required = true),
            @Parameter(name = "k2000",description = "被测参数编号",required = true),
            @Parameter(name = "k0010",description = "机器id",required = true),
            @Parameter(name = "startTime",description = "开始时间 yyyy-MM-dd HH:mm:ss",required = true),
            @Parameter(name = "endTime",description = "结束时间 yyyy-MM-dd HH:mm:ss",required = true),
            @Parameter(name = "k0053",description = "订单id",required = false)
    })
    @Operation(description = "折线图查询",summary = "折线图查询")
    public ChartModel getOrderList(Integer k1000, Short k2000, Integer k0010,@RequestParam(required = false) String k0053,String startTime,String endTime) throws CustomException {
        return this.crustalLusService.getOrderList(k1000,k2000,k0010,k0053,startTime,endTime);
    };

    @GetMapping("/box")
    @Parameters({
            @Parameter(name = "k1000",description = "零件编号",required = true),
            @Parameter(name = "k2000",description = "顺序的被测参数号",required = false),
            @Parameter(name = "k0010",description = "机器id",required = true),
            @Parameter(name = "k0053",description = "订单id",required = false),
            @Parameter(name = "startTime",description = "开始时间 yyyy-MM-dd HH:mm:ss",required = true),
            @Parameter(name = "endTime",description = "结束时间 yyyy-MM-dd HH:mm:ss",required = true)
    })
    @Operation(description = "箱型图查询",summary = "箱型图查询")
    public List<BoxModel>  getBoxList(Integer k1000,@RequestParam(required = false) Integer k2000, Integer k0010,@RequestParam(required = false) String k0053
                                        ,String startTime,String endTime)  {
        return this.crustalLusService.getBoxList( k1000, k2000, k0010,  k0053,startTime,endTime);
    };


    @GetMapping("/crustal-lus-page")
    @Operation(description = "首页查询",summary = "首页查询")
    @Parameters({
            @Parameter(name = "abilityId",description = "abilityid 产线id",required = false),
            @Parameter(name = "filterId",description = "过滤器id",required = false),
            @Parameter(name = "startTime",description = "开始时间 yyyy-MM-dd HH:mm:ss",required = true),
            @Parameter(name = "endTime",description = "结束时间 yyyy-MM-dd HH:mm:ss",required = true)
    })
    public List<CrustalLusModel>  getCrustalLusPage(@RequestParam(required = false) String abilityId,@RequestParam(required = false) String filterId, String startTime, String endTime) throws CustomException {
        return this.crustalLusService.getCrustalLusPage( abilityId,filterId, startTime, endTime);
    }

//    @GetMapping("/process")
//    @Parameters({
//            @Parameter(name = "abilityId",description = "能力产线id",required = false),
//            @Parameter(name = "filterId",description = "过滤id",required = false),
//            @Parameter(name = "startTime",description = "开始时间 yyyy-MM-dd HH:mm:ss",required = true),
//            @Parameter(name = "endTime",description = "结束时间 yyyy-MM-dd HH:mm:ss",required = true)
//    })
//    @Operation(description = "查询工序分组集合",summary = "查询工序分组集合")
//    public List<GroupModel> getCrustalLusPruefer(@RequestParam(required = false) String abilityId,@RequestParam(required = false) String filterId, String startTime, String endTime) {
//        return this.crustalLusService.getCrustalLusPruefer( abilityId,  filterId,  startTime,  endTime);
//    };

    @GetMapping("/machine")
    @Parameters({
            @Parameter(name = "filterId",description = "过滤id",required = false),
            @Parameter(name = "abilityId",description = "能力产线id",required = false),
            @Parameter(name = "startTime",description = "开始时间 yyyy-MM-dd HH:mm:ss",required = true),
            @Parameter(name = "endTime",description = "结束时间 yyyy-MM-dd HH:mm:ss",required = true)
    })
    @Operation(description = "查询机器分组集合",summary = "查询机器分组集合")
    public List<GroupModel> getCrustalLusMachine(@RequestParam(required = false) String filterId,@RequestParam(required = false) String abilityId ,String startTime, String endTime) {
        return this.crustalLusService.getCrustalLusMachine( filterId, abilityId  , startTime,  endTime);
    };

    @GetMapping("/part")
    @Parameters({
            @Parameter(name = "filterId",description = "过滤id",required = false),
            @Parameter(name = "machineId",description = "机器id",required = true),
            @Parameter(name = "startTime",description = "开始时间 yyyy-MM-dd HH:mm:ss",required = true),
            @Parameter(name = "endTime",description = "结束时间 yyyy-MM-dd HH:mm:ss",required = true)
    })
    @Operation(description = "查询零件分组集合",summary = "查询零件分组集合")
    public List<GroupModel> getCrustalLusPart(@RequestParam(required = false) String filterId, Integer machineId, String startTime, String endTime) throws CustomException {
        return this.crustalLusService.getCrustalLusPart( filterId ,  machineId,  startTime,  endTime);
    };



}
